package com.liuyi.netty.im.test.im.listeners;

import com.liuyi.netty.im.test.util.Pair;

import java.util.HashMap;
import java.util.Map;
import java.util.concurrent.ExecutorService;

/**
 * @author Mr.Fmy
 * @since 2022/1/19
 */
public class ImListenerManage {

    private final static Map<ImCode, Pair<ImListener, ExecutorService>> MAP = new HashMap<>();

    public static void registered(ImCode code, ImListener listener, ExecutorService executor) {
        MAP.put(code, new Pair<>(listener, executor));
    }

    public static Pair<ImListener, ExecutorService> get(ImCode code) {
        if (!MAP.containsKey(code)) {
            return null;
        }
        return MAP.get(code);
    }
}
